﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using FTBS.Models.DAO;
using FTBS.Models.Entities;

namespace FTBS.Models.BLO
{
    public class ChairTypeBLO
    {
        private ChairTypeDAO _chairTypeDao = new ChairTypeDAO();

        /// <summary>
        /// load chair types
        /// </summary>
        /// <returns>list of chair type</returns>
        /// <author>hungph</author>
        public List<ChairType> LoadChairTypes()
        {
            var listChairType = _chairTypeDao.LoadChairTypes();
            return listChairType;
        }

        /// <summary>
        /// select chair type
        /// </summary>
        /// <param name="id"></param>
        /// <returns>chair type</returns>
        /// <author>hungph</author>
        public ChairType SelectChairType(int id)
        {
            var chairType = _chairTypeDao.SelectChairType(id);
            return chairType;
        }

        /// <summary>
        /// create new chair type
        /// </summary>
        /// <param name="chairType"></param>
        /// <returns>success: true ,fail : false</returns>
        /// <author>hungph</author>
        public bool CreateChairType(ChairType chairType)
        {
            var isSuccess = _chairTypeDao.CreateChairType(chairType);
            if (isSuccess == 1)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// Edit chair Type
        /// </summary>
        /// <param name="chairType"></param>
        /// <returns>success: true ,fail : false</returns>
        /// <author>hungph</author>
        public bool EditChairType(ChairType chairType)
        {
            var isSuccess = _chairTypeDao.EditChairType(chairType);
            if (isSuccess == 1)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// delete chair type
        /// </summary>
        /// <param name="chairType"></param>
        /// <returns>success: true ,fail : false</returns>
        /// <author>hungph</author>
        public bool DeleteChairType(ChairType chairType)
        {
            var isSuccess = _chairTypeDao.RemoveChairType(chairType);
            if (isSuccess == 1)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// Check existed chair type
        /// </summary>
        /// <param name="chairType"></param>
        /// <returns></returns>
        /// <author>hungphp</author>
        public bool CheckExistedChairType(ChairType chairType)
        {
            var isExisted = _chairTypeDao.CheckIsExisted(chairType);
            return isExisted;
        }

        public ChairType GetChairTypeById(int id)
        {
            var chairType = _chairTypeDao.GetChairTypeById(id);
            return chairType;
        }
    }
}